//
//  ValidateMobileWithEmail.m
//  Shangubaba
//
//  Created by 微我网络 on 15/4/30.
//  Copyright (c) 2015年 waste. All rights reserved.
//

#import "ValidateMobileWithEmail.h"

@implementation ValidateMobileWithEmail


+ (BOOL)validateMobile:(NSString *)mobile
{
    //手机号以13， 15，18开头，八个 \d 数字字符
    NSString * phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$";
    NSPredicate * phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",phoneRegex];
    
    return [phoneTest evaluateWithObject:mobile];
}

+ (BOOL)isValidateEmail:(NSString *)email
{
    NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}";
    NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex];
    return [emailTest evaluateWithObject:email];
}

+ (BOOL)isChainese:(NSString *)character
{
    NSString * characterRegex = @"^[\u4E00-\u9FA5]*$";
    NSPredicate * characterTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",characterRegex];
    return [characterTest evaluateWithObject:character];
}
@end
